package com.arron.memento;

public class Client {
    public static void main(String[] args) {
        //创建游戏角色
        GameRole gameRole = new GameRole();
        gameRole.setVit(100);
        gameRole.setDef(100);
        System.out.println("和boss大战前的状态");
        gameRole.display();

        //把当前状态保存到CareTaker
        CareTaker careTaker = new CareTaker();
        careTaker.setMemento(gameRole.createMemento());

        System.out.println("和boss大战~~~");
        gameRole.setDef(30);
        gameRole.setVit(30);
        gameRole.display();
        System.out.println("大战后恢复~~~");

        gameRole.recoverGameRoleFromMemento(careTaker.getMemento());
        System.out.println("恢复后的状态~~~");
        gameRole.display();
    }
}
